<style scoped="scoped">
	.content_search_box{
		padding-top: 5px;
	    border-bottom: transparent;
	    min-width: auto;
	    position: absolute;
	    z-index: 100;
	    right: 0px;
	}
</style>
<template>
  <div style="margin:5px 10px;" >
	  	<div class="content_search_box" style="top: 42px;display:flex">
			<i @click="tableType = 'hengbiao'" :class="{'cur_point_li':tableType == 'hengbiao'}" class="iconfont icon-hengbiaotou c_pointer mt5">横表</i>
			<i @click="tableType = 'shubiao'" :class="{'cur_point_li':tableType == 'shubiao'}" class="iconfont icon-shubiaotou c_pointer ml10 mt5">竖表</i>
			<!-- <div v-if="$store.state.permission.buttonPageObj['download.applyData']">
				<el-button type="primary" class="ml5" @click="download('/line/downloadLineTableResult?')">下载原始值</el-button>
				<el-button type="primary" @click="download('/point/downloadPointTableResult?')" >下载应用数据</el-button>
			</div> -->
	  	</div>
		<hengbiao v-if="tableType == 'hengbiao'" ref="gridRef" :pointList = "pointList" :searchFactor="searchFactor"  />
		<shubiao v-else ref="gridRef" :pointList = "pointList" :searchFactor="searchFactor"/>
	   
  </div>
</template>
<script>
	import { util } from "@/utils/common.js";
	import hengbiao from "./grid/hengbiao"
	import shubiao from "./grid/shubiao"
	export default {
		components:{
			hengbiao,
			shubiao
		},
	props:{
	 	pointList:{
	 		type:Array
	 	},
	 	searchFactor:{
	 		type:Object
	 	}
	},
  data() {
    return { 
		tableType:'hengbiao'
    }
  },
  mounted(){
  	this.render();
  },
  	watch:{
		searchFactor:{
			handler(){
				this.render();
			},
			deep:true
		}
	},
  methods:{ 
	render(){
		this.$refs.gridRef.render();
	},
  	download(downUrl){
  		let sendData = {};
  		sendData.pointId = this.searchFactor.pointIds.toString()
  		sendData.startTime = this.searchFactor.modify_start_time||"*"
  		sendData.endTime = this.searchFactor.modify_end_time||"*"
  		sendData.token = util.getToken();
  		let url = util.downBaseUrl+downUrl+util.parseParam(sendData)
  			url = encodeURI(url)
			url = url.replace(new RegExp(/(#)/g),encodeURIComponent('#'))
			url = url.replace(new RegExp(/\+/g),encodeURIComponent('+'))
  		window.open(url)
  	}
  }
};
</script>

